/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Progra1;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author manuel
 */
public class servletCaso8 extends HttpServlet {

   


    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
         try {
            Caso8BD manejoBD = new Caso8BD();
            manejoBD.conectarBD();
            long duracion=0;
            String fecha = (String) request.getParameter("fecha");
            int monto = Integer.parseInt(request.getParameter("monto"));
            String moneda = (String) request.getParameter("moneda");
            String origen = (String) request.getParameter("NoCuentaOrigen");
            String destino = (String) request.getParameter("NoCuentaDestino");
            int caso = Integer.parseInt(request.getParameter("caso"));
      

            if(caso==2){
              duracion= manejoBD.caso8TransApp(fecha, monto, moneda, origen, destino);
            }else if(caso==1){
               duracion= manejoBD.caso8TransBD(fecha, monto, moneda, origen, destino);
            }
            request.setAttribute("duracion", duracion);
            RequestDispatcher view = request.getRequestDispatcher("Caso8.jsp");
            view.forward(request, response);

        } catch (Throwable exc) {
            System.out.println(exc);
        }

    }
}
